﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace WpfApp3ValueConvertersWeatherForecast
{
    public class GeneralForecastToBrushConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType != typeof(Brush))
                throw new ArgumentException("targetType");

            var gf = (GeneralForecast)value;
            return gf switch
            {
                GeneralForecast.Cloudy => Brushes.LightGray,
                GeneralForecast.Dry => Brushes.LightYellow,
                GeneralForecast.Rainy => Brushes.LightGreen,
                GeneralForecast.Snowy => Brushes.LightBlue,
                GeneralForecast.Sunny => Brushes.Yellow,
                _ => Binding.DoNothing
            };
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
